#pragma once
#include <vector>
#include <list>
#include <queue>
#include <iostream>
using namespace std;

namespace xzq
{
    template <class T, class Container = deque<T>>
    class queue
    {
    public:
        void push(const T &x)
        {
            _con.push_back(x);
        }
        void pop()
        {
            _con.pop_front();
        }
        size_t size()
        {
            return _con.size();
        }
        bool empty()
        {
            return _con.empty();
        }
        T &front()
        {
            return _con.front();
        }
        T &back()
        {
            return _con.back();
        }

    private:
        Container _con;
    };
    void test_list()
    {
        queue<int, list<int>> q;
        q.push(1);
        q.push(2);
        q.pop();
        q.push(3);
        q.push(4);
        cout << q.front() << endl;
        cout << q.back() << endl;
        while (!q.empty())
        {
            cout << q.front() << " ";
            q.pop();
        }
        cout << endl;
        cout << q.size() << endl;
    }
    void test_deque()
    {
        queue<int> q;
        q.push(1);
        q.push(2);
        q.pop();
        q.push(3);
        q.push(4);
        cout << q.front() << endl;
        cout << q.back() << endl;
        while (!q.empty())
        {
            cout << q.front() << " ";
            q.pop();
        }
        cout << endl;
        cout << q.size() << endl;
    }
}